package cn.itsource.controller;

import cn.itsource.feign.client.EmailFeignClient;
import cn.itsource.feign.client.SmsFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SystemController {
    @Autowired
    private EmailFeignClient emailFeignClient;

    @Autowired
    private SmsFeignClient smsFeignClient;

    @GetMapping("/userServer/{server}")
    public String server(@PathVariable("server") String server){
        if(server.equals("email")){
            return emailFeignClient.userServer();
        }else if(server.equals("sms")){
            return smsFeignClient.userServer();
        }
        return null;
    }
}
